import java.io.FileInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;

public class Test2 {
    public static void main(String[] args) throws Exception {
        try(
                FileInputStream stream = new FileInputStream("person.obj");
                ObjectInputStream stream1 = new ObjectInputStream(stream);
                ) {
            Person o = (Person)stream1.readObject();
            System.out.println(o);
        } catch (IOException e) {
            throw new RuntimeException(e);
        } catch (ClassNotFoundException e) {
            throw new RuntimeException(e);
        }
    }
}
